var video_json = null;

function listVideo() {

	/*
	 * 
	 */
	var xhr = false;
	xhr = new XMLHttpRequest();
	xhr.onreadystatechange = function() {
		var message;
		if (xhr.readyState == 4) {
			if (xhr.status == 200) {

				video_json = JSON.parse(xhr.responseText);

				/*
				 * 
				 * 清空原表数据
				 * 
				 */
				var new_tr_list = document.getElementsByClassName("new_tr");
				var long = new_tr_list.length;

				for (var num = 0; num < long; num++) {
					new_tr_list[0].parentNode.removeChild(new_tr_list[0]);
				}
				/*
				 * 
				 */
				var table_video = document.getElementById("table_video");

				var new_tr;
				var new_td;
				for (var num = 0; num < video_json.length; num++) {
					new_tr = document.createElement("tr");
					table_video.firstElementChild.appendChild(new_tr);
					new_tr.className = "new_tr";

					/*
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_teacher;
					/*
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_name;
					/*
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_recordDate;
					/*
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_lessonName;
					/*
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_grade;
					/*
					 * 
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = video_json[num].video_memo;
					/*
					 * 是否标注
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					// new_td.innerHTML = video_json[num].;
					/*
					 * 
					 */
					new_td = document.createElement("td");
					new_tr.appendChild(new_td);
					new_td.innerHTML = '<i title="评注" id="'
							+ video_json[num].video_name
							+ '" class="fa fa-pencil" onclick="evaluationVideo(this)"></i>&nbsp;&nbsp;'
							+ '<i title="删除" id="'
							+ video_json[num].video_id
							+ '" class="fa fa-trash" style="color:#ff5063;" onclick="deleteVideo(this)"></i>';

				}

				// 让加载图标消失
				document.getElementById("i_pulse").style.display = "none";

			} else {
				// toastr.error(xhr.status);
			}
		}
	}

	xhr.open("POST", "/jxfgyj/video/listVideo");

	xhr.send(null);

}
